//新闻
import { NEWS } from './api';
import { request, METHOD } from '@/utils/request';
//添加新闻
export async function addNewsApi(params) {
  return request(NEWS + '/create', METHOD.POST, params);
}
//删除新闻
export async function delNewsApi(params) {
  return request(NEWS + '/delete/', METHOD.DELETE, params.id);
}
//修改新闻
export async function editNewsApi(params) {
  return request(NEWS + '/update/', METHOD.PUT, params);
}
//获取所有新闻
export async function getNewsListApi(params) {
  return request(NEWS + '/getAll', METHOD.GET, params);
}
//根据id查找新闻
export async function getNewsByIdApi(params) {
  return request(NEWS + '/getById', METHOD.GET, params);
}
export default {
  addNewsApi,
  delNewsApi,
  editNewsApi,
  getNewsListApi,
  getNewsByIdApi,
};
